package com.lanou3g.code0523.permission;

import javax.servlet.DispatcherType;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/*
Filter可以通过DispatcherType来 配置拦截方式
有4种拦截方式比较常用
1.REQUEST:默认拦截方式,如果不写该项配置,则只用此拦截方式
         请求,转发,包含都不再进行拦截
2.FORWARD:拦截请求转发
3.INCLUDE:拦截请求包含
4.ERROR: 如果在jsp中 配置了errorPage,当出现异常时,进入errorPage
         之前,可以被该拦截器拦截
默认不写是request,只要写了无论写什么都以写的为准 即不再提供默认,如果
还想拦截请求,则需要手动写上.
 */
@WebFilter(filterName = "myFilter",urlPatterns = "/user/*",dispatcherTypes = {DispatcherType.FORWARD,DispatcherType.REQUEST})
public class MyFilter extends BaseFilter {
    @Override
    public void doFilter(HttpServletRequest servletRequest, HttpServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {

    }
}
